{extend name="base/index"/}
{block name="page_location"}
<div class="page-title-right">
	<ol class="breadcrumb m-0">
		<li class="breadcrumb-item"><a href="{:url('index/index')}">管理中心</a></li>
		<li class="breadcrumb-item active"><i class="iconfont icon-angle-right"></i>系统设置</li>
	</ol>
</div>
<h4 class="page-title">{$page_title}</h4>
{/block}
{block name="body"}
<script src="__PLUGIN__/ueditor/ueditor.config.js" type="text/javascript"></script>
<script src="__PLUGIN__/ueditor/ueditor.all.min.js" type="text/javascript"></script>
<div class="card" id="sysset_page">
	<div class="card-body">
		<!-- <h4 class="header-title mb-3">系统设置</h4> -->
		<ul class="nav nav-tabs nav-justified nav-bordered mb-3">
			{volist name="config_class_list" id="data"}
			<li class="nav-item">
				<a href="#tab_1_{$data.id}" data-toggle="tab" aria-expanded="false" class="nav-link {eq name="key" value="0"}active{/eq}"> 
					<i class="mdi mdi-home-variant d-lg-none d-block mr-1"></i>
					<span class="d-none d-lg-block">{$data.classname}</span>
				</a>
			</li>
			{/volist}
		</ul>
		<div class="tab-content">
		{volist name="config_class_list" id="data"}
		<div class="tab-pane {eq name='key' value='0'}active{/eq}" id="tab_1_{$data.id}">
			<form action="#" class="form-horizontal config_edit_frm" id="config_{$data.classid}_frm">
				<input type="hidden" name="classid" value="{$data.id}" />
				<input type="hidden" name="group" value="{$data.group}" />
				{volist name="data.nodelist" id="node"}
				{switch name="node.type"}
				{case value="text"}

				<div class="form-group row mb-1">
					<label for="ipt_{$node.name}" class="col-3 col-form-label">{$node.title}[ID:{$node.id}]：</label>
					<div class="col-5">
						<input type="text" class="form-control" id="ipt_{$node.name}" name="{$node.name}"
							value="{$node.value}" placeholder="">
						<p class="font-13 text-muted">{$node.hint}</p>
					</div>
					<div class="col-3">
						{eq name="AdminInfo.username" value="developer"}
						<a href="javascript:;" class="badge badge-danger del_config" attr-id="{$node.id}">删除</a>
						<a href="javascript:;" class="badge badge-danger edit_config" data-toggle="modal"
							data-target="#edit_config_box" attr-id="{$node.id}">编辑</a>
						{/eq}
					</div>
				</div>
				{/case}
				{case value="password"}
				<div class="form-group row mb-1">
					<label for="ipt_{$node.name}" class="col-3 col-form-label">{$node.title}[ID:{$node.id}]：</label>
					<div class="col-5">
						<input type="password" class="form-control" id="ipt_{$node.name}" name="{$node.name}" value="{$node.value}" placeholder="">
						<p class="font-13 text-muted">{$node.hint}</p>
					</div>
					<div class="col-3">
						<span class="badge badge-primary secret_txt_show" attr-id="ipt_{$node.name}" title="显示/隐藏"><i class="iconfont icon-eye-fill"></i></span>
						{eq name="AdminInfo.username" value="developer"}
						<a href="javascript:;" class="badge badge-danger del_config" attr-id="{$node.id}">删除</a>
						<a href="javascript:;" class="badge badge-danger edit_config" data-toggle="modal"
							data-target="#edit_config_box" attr-id="{$node.id}">编辑</a>
						{/eq}
					</div>
				</div>
				{/case}
				{case value="bigtext"}
				<div class="form-group row mb-1">
					<label for="ipt_{$node.name}"
						class="col-3 col-form-label">{$node.title}[ID:{$node.id}]：</label>
					<div class="col-5">
						<textarea class="form-control" rows="3" name="{$node.name}">{$node.value}</textarea>
						<p class="font-13 text-muted">{$node.hint}</p>
					</div>
					<div class="col-3">
						{eq name="AdminInfo.username" value="developer"}
						<a href="javascript:;" class="badge badge-danger del_config" attr-id="{$node.id}">删除</a>
						<a href="javascript:;" class="badge badge-danger edit_config" data-toggle="modal"
							data-target="#edit_config_box" attr-id="{$node.id}">编辑</a>
						{/eq}
					</div>
				</div>
				{/case}
				{case value="radio"}
				<div class="form-group row mb-1">
					<label for="ipt_{$node.name}"
						class="col-3 col-form-label">{$node.title}[ID:{$node.id}]：</label>
					<div class="col-5">
						{volist name="node.datanode" id="nodedata"}
						<div class="custom-control custom-radio">
							<input type="radio" name="{$node.name}" id="radio_{$node.name}_{$nodedata.key}"
								value="{$nodedata.key}" {eq name='$nodedata.ischecked' value="checked" }
								checked="checked" {/eq} class="custom-control-input">
							<label class="custom-control-label"
								for="radio_{$node.name}_{$nodedata.key}">{$nodedata.value}</label>
						</div>
						{/volist}
						<p class="font-13 text-muted">{$node.hint}</p>
					</div>
					<div class="col-3">
						{eq name="AdminInfo.username" value="developer"}
						<a href="javascript:;" class="badge badge-danger del_config" attr-id="{$node.id}">删除</a>
						<a href="javascript:;" class="badge badge-danger edit_config" data-toggle="modal"
							data-target="#edit_config_box" attr-id="{$node.id}">编辑</a>
						{/eq}
					</div>
				</div>
				{/case}
				{case value="checkbox"}
				<div class="form-group row mb-1">
					<label for="ipt_{$node.name}"
						class="col-3 col-form-label">{$node.title}[ID:{$node.id}]：</label>
					<div class="col-5">
						{volist name="node.datanode" id="nodedata"}
						<div class="custom-control custom-checkbox">
							<input type="checkbox" name="{$node.name}[]" id="checkbox_{$node.name}_{$nodedata.key}"
								value="{$nodedata.key}" {eq name='$nodedata.ischecked' value="checked" }
								checked="checked" {/eq} class="custom-control-input">
							<label class="custom-control-label"
								for="checkbox_{$node.name}_{$nodedata.key}">{$nodedata.value}</label>
						</div>
						{/volist}
						<p class="font-13 text-muted">{$node.hint}</p>
					</div>
					<div class="col-3">
						{eq name="AdminInfo.username" value="developer"}
						<a href="javascript:;" class="badge badge-danger del_config" attr-id="{$node.id}">删除</a>
						<a href="javascript:;" class="badge badge-danger edit_config" data-toggle="modal"
							data-target="#edit_config_box" attr-id="{$node.id}">编辑</a>
						{/eq}
					</div>
				</div>
				{/case}
				{case value="list"}
				<div class="form-group row mb-1">
					<label for="ipt_{$node.name}" class="col-3 col-form-label">{$node.title}[ID:{$node.id}]：</label>
					<div class="col-5">
						<select class="form-control" id="example-select">
							{volist name="node.datanode" id="nodedata"}
							<option value="{$nodedata.key}" {eq name='$nodedata.ischecked' value="checked" }
								selected="selected" {/eq}>{$nodedata.value} </option> {/volist} </select> 
								<p class="font-13 text-muted">{$node.hint}</p>
					</div>
					<div class="col-3">
						{eq name="AdminInfo.username" value="developer"}
						<a href="javascript:;" class="badge badge-danger del_config" attr-id="{$node.id}">删除</a>
						<a href="javascript:;" class="badge badge-danger edit_config" data-toggle="modal"
							data-target="#edit_config_box" attr-id="{$node.id}">编辑</a>
						{/eq}
					</div>
				</div>
				{/case}
				{case value="file"}
				<div class="form-group row mb-1">
					<label for="ipt_{$node.name}"
						class="col-3 col-form-label">{$node.title}[ID:{$node.id}]：</label>
					<div class="col-5">
						<div class="config_uploadfile {$node.name}" attr-value="{$node.value}"></div>
						<p class="font-13 text-muted" style="clear: both;">{$node.hint}</p>
					</div>
					<div class="col-3">
						{eq name="AdminInfo.username" value="developer"}
						<a href="javascript:;" class="badge badge-danger del_config" attr-id="{$node.id}">删除</a>
						<a href="javascript:;" class="badge badge-danger edit_config" data-toggle="modal"
							data-target="#edit_config_box" attr-id="{$node.id}">编辑</a>
						{/eq}
					</div>
				</div>
				<script type="text/javascript">
					$(function () {
						File_Upload('.{$node.name}', 'file', '{$node.name}', false);
					});
				</script>
				{/case}
				{case value="image"}
				<div class="form-group row mb-1">
					<label for="ipt_{$node.name}"
						class="col-3 col-form-label">{$node.title}[ID:{$node.id}]：</label>
					<div class="col-5">
						<div class="config_uploadfile {$node.name}" attr-value="{$node.value}"></div>
						<p class="font-13 text-muted" style="clear: both;">{$node.hint}</p>
					</div>
					<div class="col-3">
						{eq name="AdminInfo.username" value="developer"}
						<a href="javascript:;" class="badge badge-danger del_config" attr-id="{$node.id}">删除</a>
						<a href="javascript:;" class="badge badge-danger edit_config" data-toggle="modal"
							data-target="#edit_config_box" attr-id="{$node.id}">编辑</a>
						{/eq}
					</div>
				</div>
				<script type="text/javascript">
					$(function () {
						File_Upload('.{$node.name}', 'image', '{$node.name}', false);
					});
				</script>
				{/case}
				{case value="single_ueditor"}
				<div class="form-group row mb-1">
					<label for="ipt_{$node.name}" class="col-3 col-form-label">{$node.title}[ID:{$node.id}]：</label>
					<div class="col-5">
						<textarea id="{$node.name}" name="{$node.name}">{$node.value}</textarea>
						<p class="font-13 text-muted">{$node.hint}</p>
					</div>
					<div class="col-3">
						{eq name="AdminInfo.username" value="developer"}
						<a href="javascript:;" class="badge badge-danger del_config" attr-id="{$node.id}">删除</a>
						<a href="javascript:;" class="badge badge-danger edit_config" data-toggle="modal"
							data-target="#edit_config_box" attr-id="{$node.id}">编辑</a>
						{/eq}
					</div>
				</div>
				<script type="text/javascript">
					$(function () {
						var {$node.name} = UE.getEditor(
							'{$node.name}', {
								serverUrl: '/static/plugin/ueditor/php/controller.php',
								toolbars: Get_UEditor_Config('single'),
								initialFrameWidth: '99%',
								initialFrameHeight: 200
							}
						);
					});
				</script>
				{/case}
				{case value="partition"}
				<h4 class="header-title partition_style">
					{$node.title}
					{eq name="AdminInfo.username" value="developer"}
					<a href="javascript:;" class="badge badge-danger del_config" style="display: inline-block;" attr-id="{$node.id}">删除</a>
					<a href="javascript:;" class="badge badge-danger edit_config" style="display: inline-block;" data-toggle="modal"
						data-target="#edit_config_box" attr-id="{$node.id}">编辑</a>
					{/eq}
				</h4>
				<p class="text-muted">{$node.hint}</p>				
				{/case}				
				{/switch}
				{/volist}
				<div class="form-actions col-4" style="text-align:right;">
					<button type="button" class="btn btn-primary add_config_save_btn" attr-class="{$data.classid}">保存</button>
				</div>
			</form>
		</div>
		
	{/volist}
	</div>
{/block}
{block name="modal_dig"}
	<!-- END CONTAINER -->
	<!-- Modal -->
	{eq name="AdminInfo.username" value="developer"}
	<div id="edit_config_box" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"	 aria-hidden="true">
		<div class="modal-dialog modal-full-70">
			<div class="modal-content">
				<div class="modal-header">
					<h4 class="modal-title" id="myModalLabel">修改配置</h4>
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
				</div>
				<div class="modal-body">
					<form action="#" class="form-horizontal" id="edit_config_frm">
						<input type="hidden" name="id" value="" />
						<input type="hidden" name="group" value="goods" />
						<div class="form-group row mb-1">
							<label for="ipt_classid" class="col-3 col-form-label">选择一个配置分类</label>
							<div class="col-5">
								<select class="form-control" name="classid" id="classid">
									{volist name="config_class_list" id="data"}
									<option value="{$data.classid}">{$data.classname}</option>
									{/volist}
								</select>
								<span class="font-13 text-muted"></span>
							</div>
						</div>
						<div class="form-group row mb-1">
							<label for="ipt_config_name" class="col-3 col-form-label">配置名称:</label>
							<div class="col-5">
								<input type="text" class="form-control ipt_check" data-type="string" data-len="3-10" readonly="readonly"
									nullmsg="显示名称不能为空" errormsg="显示名称只能由3到10位的中文、字母、数字组成" name="name">
								<span class="font-13 text-muted">注：配置名称只能是英文</span>
							</div>
						</div>
						<div class="form-group row mb-1">
							<label for="ipt_config_title" class="col-3 col-form-label">配置显示名称:</label>
							<div class="col-5">
								<input type="text" class="form-control ipt_check" data-type="string" data-len="3-10"
									nullmsg="显示名称不能为空" errormsg="显示名称只能由3到10位的中文、字母、数字组成" name="title">
								<span class="font-13 text-muted">注：配置名称只能是英文</span>
							</div>
						</div>
						<div class="form-group row mb-1">
							<label for="ipt_type" class="col-3 col-form-label">配置类型:</label>
							<div class="col-5">
								<div class="custom-control custom-radio">
									<input type="radio" name="type" id="ctype2_1" class="custom-control-input" value="text">
									<label class="custom-control-label" for="ctype2_1">普通文本型</label>
								</div>
								<div class="custom-control custom-radio">
									<input type="radio" name="type" id="ctype2_2" class="custom-control-input" value="password">
									<label class="custom-control-label" for="ctype2_2">密钥文本型</label>
								</div>
								<div class="custom-control custom-radio">
									<input type="radio" name="type" id="ctype2_3" class="custom-control-input" value="bigtext">
									<label class="custom-control-label" for="ctype2_3">多行文本型</label>
								</div>
								<div class="custom-control custom-radio">
									<input type="radio" name="type" id="ctype2_4" class="custom-control-input" value="radio">
									<label class="custom-control-label" for="ctype2_4">单选型</label>
								</div>
								<div class="custom-control custom-radio">
									<input type="radio" name="type" id="ctype2_5" class="custom-control-input" value="checkbox">
									<label class="custom-control-label" for="ctype2_5">多选型</label>
								</div>
								<div class="custom-control custom-radio">
									<input type="radio" name="type" id="ctype2_6" class="custom-control-input" value="single_ueditor">
									<label class="custom-control-label" for="ctype2_6">富文本编辑型</label>
								</div>
								<div class="custom-control custom-radio">
									<input type="radio" name="type" id="ctype2_7" class="custom-control-input" value="list">
									<label class="custom-control-label" for="ctype2_7">列表类型</label>
								</div>
								<div class="custom-control custom-radio">
									<input type="radio" name="type" id="ctype2_8" class="custom-control-input" value="file">
									<label class="custom-control-label" for="ctype2_8">文件类型</label>
								</div>
								<div class="custom-control custom-radio">
									<input type="radio" name="type" id="ctype2_9" class="custom-control-input" value="image">
									<label class="custom-control-label" for="ctype2_9">图片类型</label>
								</div>
								<div class="custom-control custom-radio">
									<input type="radio" name="type" id="ctype2_10" class="custom-control-input"
										value="partition">
									<label class="custom-control-label" for="ctype2_10">分隔线型</label>
								</div>
								<span class="font-13 text-muted"></span>
							</div>
						</div>
						<div class="form-group row mb-1">
							<label for="ipt_config_data" class="col-3 col-form-label">配置数据:</label>
							<div class="col-5">
								<textarea class="form-control" rows="3" name="data"
									placeholder="选项名称:选项值"></textarea>
								<span class="font-13 text-muted">注：用于单选、多选、列表类型，每行一个选项</span>
							</div>
						</div>					
						<div class="form-group row mb-1">
							<label for="ipt_config_default_value" class="col-3 col-form-label">配置默认值:</label>
							<div class="col-5">
								<input type="text" class="form-control" name="defaultvalue">
								<span class="font-13 text-muted">注：配置默认值(多个选项值请用英文,号分开)</span>
							</div>
						</div>
						<div class="form-group row mb-1">
							<label for="ipt_config_hint" class="col-3 col-form-label">配置备注信息:</label>
							<div class="col-5">
								<input type="text" class="form-control" name="hint">
								<span class="font-13 text-muted">注：此名称用于备注配置功能</span>
							</div>
						</div>
						<div class="form-group row mb-1">
							<label for="ipt_isdeveloper" class="col-3 col-form-label">是否属于开发者:</label>
							<div class="col-5">
								<div class="custom-control custom-radio">
									<input type="radio" name="isdeveloper" id="isdeveloper2_1" class="custom-control-input"
										value="0" checked="checked">
									<label class="custom-control-label" for="isdeveloper2_1">普通管理</label>
								</div>
								<div class="custom-control custom-radio">
									<input type="radio" name="isdeveloper" id="isdeveloper2_2" class="custom-control-input"
										value="1">
									<label class="custom-control-label" for="isdeveloper2_2">开发者管理</label>
								</div>
								<span class="font-13 text-muted"></span>
							</div>
						</div>
						<div class="form-group row mb-1">
							<label for="ipt_config_orderid" class="col-3 col-form-label">排序ID:</label>
							<div class="col-2">
								<input type="number" class="form-control ipt_check" name="orderid" data-type="integer"
									data-len="1-4" nullmsg="排序不能为空" errormsg="排序只能由1到4位的数字组成" value="1">
							</div>
						</div>
					</form>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-light" data-dismiss="modal">关闭</button>
					<button type="button" class="btn btn-primary Fast_Form_Post" attr-frm="#edit_config_frm" attr-callback="reload" attr-model="sysset" attr-active="saveconfig">确认修改</button>
				</div>
			</div><!-- /.modal-content -->
		</div><!-- /.modal-dialog -->
	</div><!-- /.modal -->
	{/eq}
{/block}